import React from 'react';
import {inject, observer} from 'mobx-react';
import { Route, withRouter, Switch } from 'react-router-dom';
import { asyncComponent } from 'react-async-component';
import QueueAnim from 'rc-queue-anim';

const coms = {
  GroupManagement: asyncComponent({ // 微博关注-我的关注-分组管理
    resolve: () => import('../userCenter/blogAttention/GroupManagement')
  }),
  MsgRemind: asyncComponent({ // 个人中心-消息提醒
    resolve: () => import('../userCenter/MsgRemind')
  }),
	Setting: asyncComponent({ // 个人中心-微博设置
    resolve: () => import('../userCenter/setting')
  }),
  BlogWrite: asyncComponent({ // 写微博
    resolve: () => import('../public/BlogWrite')
  }),
  BlogNoteWrite: asyncComponent({ // 写微博
        resolve: () => import('../public/BlogNoteWrite')
  }),
  ShareToMeWeibo: asyncComponent({ // 写微博
    resolve: () => import('../userCenter/shareToMe/ShareToMeWeibo')
  }),
  BatchAttention: asyncComponent({ // 写微博
    resolve: () => import('../userCenter/shareToMe/BatchAttention')
  }),
  AddShare: asyncComponent({ // 新增分享配置
    resolve: () => import('../userCenter/shareSet/AddShare')
  }),
  EditShare: asyncComponent({ // 新增分享配置
    resolve: () => import('../userCenter/shareSet/EditShare')
  }),
  DiscussShareTool: asyncComponent({ // 分享微博
        resolve: () => import('../public/DiscussShareTool')
  }),
  Test:   asyncComponent({ // 分享微博
      resolve: () => import('../public/CustomHrmResource')})

}

@withRouter
@inject('myBlogStore','hisBlogStore')
@observer
export default class RouteModal extends React.Component {
  render() {
    return (
      <Switch>
        <Route 
          key="groupManagement"
          path="/userCenter/blogAttention/attention/groupManagement"
          breadcrumbName="微博关注-我的关注-分组管理"
          render={() => (
            <div className="wm-route-layout">
              <QueueAnim>
                <coms.GroupManagement key="seeting" />
              </QueueAnim>
            </div>
          )}
        />
        <Route 
          key="msgRemind"
          path="/userCenter/msgRemind"
          breadcrumbName="个人中心-消息提醒"
          render={() => (
            <div className="wm-route-layout">
              <QueueAnim>
                <coms.MsgRemind key="msgRemind" />
              </QueueAnim>
            </div>
          )}
        />
        <Route 
          key="setting"
          path="/userCenter/setting"
          breadcrumbName="个人中心-微博设置"
          render={() => (
            <div className="wm-route-layout">
              <QueueAnim>
                <coms.Setting key="seeting" />
              </QueueAnim>
            </div>
          )}
        />
        <Route 
          key='blogWrite'
          path='/myBlog/writeBlog'

          breadcrumbName="编辑评论"
          render={() => (
            <div className="wm-route-layout">
              <QueueAnim>
                <coms.BlogWrite writeBlogStore={this.props.myBlogStore} storeName='myBlog' />
              </QueueAnim>
            </div>
          )}
        />
          <Route
              key='blogNoteWrite'
              path='/myBlog/writeBlogNote'
              breadcrumbName="编辑"
              render={() => (
                  <div className="wm-route-layout">
                      <QueueAnim>
                          <coms.BlogNoteWrite writeBlogStore={this.props.myBlogStore} storeName='myBlog' />
                      </QueueAnim>
                  </div>
              )}
          />

          <Route
              key='test'
              path='/myBlog/test'
              breadcrumbName="分享微博"
              render={() => (
                  <div className="wm-route-layout" style={{"overflow":'auto',"margin-top": "46px","height": "calc(100vh - 90px)"}}>
                      <QueueAnim>
                          <coms.Test />
                      </QueueAnim>
                  </div>
              )}
          />
      <Route 
          key="shareToMeWeibo"
          path="/userCenter/shareToMe/shareToMeWeibo"
          breadcrumbName="个人中心-消息提醒"
          render={() => (
            <div className="wm-route-layout">
              <QueueAnim>
                <coms.ShareToMeWeibo key="shareToMeWeibo" />
              </QueueAnim>
            </div>
          )}
        />
      <Route 
          key="batchAttention"
          path="/userCenter/shareToMe/BatchAttention"
          breadcrumbName="个人中心-消息提醒"
          render={() => (
            <div className="wm-route-layout">
              <QueueAnim>
                <coms.BatchAttention key="batchAttention" />
              </QueueAnim>
            </div>
          )}
        />
        <Route 
          key="addShare"
          path="/userCenter/shareSet/AddShare"
          breadcrumbName="分享设置-新增"
          render={() => (
            <div className="wm-route-layout">
              <QueueAnim>
                <coms.AddShare key="addShare" />
              </QueueAnim>
            </div>
          )}
        />
         <Route 
          key="editShare"
          path="/userCenter/shareSet/EditShare"
          breadcrumbName="分享设置-编辑"
          render={() => (
            <div className="wm-route-layout">
              <QueueAnim>
                <coms.EditShare key="editShare" />
              </QueueAnim>
            </div>
          )}
        />
      </Switch>
    )
  }
}